import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};
export type infoType = {
	id?: number,
	projectId?: number,
	productAlarmTitle?: string,
	productName?: string,
	status?: number,
	deviceSN?: string,
	alarmTitle?: string,
	alarmLevel?: number,
	alarmType?: number,
	dealStatus?: number,
	updatedByName?: string,
	lastDealUid?: number,
	updatedAt?: string,
	place?: string,
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/business/alarm/v2/alarm-rules';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
//告警规则同步
export const alarmsync = (data?: object) => {
  return http.request<commonResult<any>>("post", "/business/alarm/v2/alarm-rules/sync", {
    data
  });
};
//恢复默认
export const alarmreset = (data?: object) => {
    return http.request<commonResult<any>>("put", "/business/alarm/v2/alarm-rules/reset", {
      data
    });
  };
//获取产品类型数据 2.15.2 获取项目下已添加设备产品类型
export const alarmproduct = (params?: object) => {
  return http.request<commonResult<infoType[]>>("get", "/business/product/v2/product/select", {
    params
  });
};
//修改告警事件等级 /business/alarm/v2/alarm-rules/level
export const alarmlevel = (data?: object) => {
  return http.request<commonResult<any>>("put", "/business/alarm/v2/alarm-rules/level", {
    data
  });
};
//修改告警规则启用状态 
export const alarmstatus = (data?: object) => {
  return http.request<commonResult<infoTypeList>>("put", "/business/alarm/v2/alarm-rules/status", {
    data
  });
};